class Solution
{
public:
    void moveZeroes(vector<int>& nums)
    {
        int cur = 0;
        int dest = -1;
        int size = nums.size();
        while (cur < size)
        {
            if (nums[cur] == 0)
            {
                cur++;
            }
            else
            {
                dest++;
                swap(nums[dest], nums[cur]);
                cur++;
            }
        }
    }
};